
public class DuckSimulator {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		DuckSimulator simulator = new DuckSimulator();
		simulator.simulate();

	}
	
	void simulate()
	{
		IQuackable mallardDuck = new QuackCounter(new MallardDuck());
		IQuackable redheadDuck = new QuackCounter(new RedheadDuck());
		IQuackable duckCall = new QuackCounter(new DuckCall());
		IQuackable rubberDuck = new QuackCounter(new RubberDuck());
		IQuackable gooseDuck = new GooseAdapter(new Goose());
			
		System.out.println("\nDuck Simulator : With Decorater");
		
		simulate(mallardDuck);
		simulate(redheadDuck);
		simulate(duckCall);
		simulate(rubberDuck);
		simulate(gooseDuck);
		
		System.out.println("The ducks quacked " + QuackCounter.getQuacks() + "times");
	}
	
	void simulate(IQuackable duck)
	{
		duck.quack();
	}
}
